package com.kun97.im.controller;

import com.kun97.im.dal.mapper.ChatRoomMapper;
import com.kun97.im.model.ChatRoom;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: im
 * @BelongsPackage: com.kun97.im.controller
 * @Author: zk
 * @CreateTime: 2019-01-01 17:37
 * @Description:
 */
@RestController
@RequestMapping("/im/api/chatroom/")
public class ChartRoomController {

    @Resource
    private ChatRoomMapper chatRoomMapper;

    @RequestMapping("getAllChartRoom")
    List<ChatRoom> getAllChartRoom() {
        return chatRoomMapper.select();
    }

    @RequestMapping("updateByPrimaryKey")
    int updateByPrimaryKey(@RequestBody ChatRoom chatRoom) {
        return chatRoomMapper.updateByPrimaryKey(chatRoom);
    }

    @RequestMapping("deleteByPrimaryKey")
    int deleteByPrimaryKey(@RequestParam Long chatId) {
        return chatRoomMapper.deleteByPrimaryKey(chatId);
    }

    @RequestMapping("saveChartRoom")
    int saveChartRoom(@RequestBody ChatRoom chatRoom) {
        return chatRoomMapper.insert(chatRoom);
    }

}
